home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 December / PCWorld_2007-12_cd.bin / v cisle / htttrack / httrack-3.41-3.exe / {app} / src / mmsrip / mms.h < prev    next >
C/C++ Source or Header  |  2006-07-30  |  3KB  |  132 lines

  1. /*
  2.  * $RCSfile: mms.h,v $
  3.  * $Date: 2006/01/23 20:30:43 $ - $Revision: 1.17 $
  4.  *
  5.  * This file is distributed as a part of MMSRIP ( MMS Ripper ).
  6.  * Copyright (c) 2005-2006 Nicolas BENOIT
  7.  *
  8.  * It is highly based on the work of SDP Multimedia and Major MMS.
  9.  * They deserve all the credits for it.
  10.  *
  11.  * This program is free software; you can redistribute it and/or modify it
  12.  * under the terms of the GNU General Public License as published by the
  13.  * Free Software Foundation; either version 2, or (at your option) any
  14.  * later version.
  15.  *
  16.  * This program is distributed in the hope that it will be useful,
  17.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  19.  * GNU General Public License for more details.
  20.  *
  21.  * You should have received a copy of the GNU General Public License
  22.  * along with this program; if not, write to the Free Software
  23.  * Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  24.  *
  25.  */
  26.  
  27.  
  28. #ifndef __MMS_H__
  29. #define __MMS_H__
  30.  
  31. #include "common.h"
  32.  
  33. #ifdef _WIN32
  34. typedef signed long int ssize_t;
  35. #define bcopy(s, d, l) memcpy(d, s, l)
  36. #include <assert.h>
  37. #define close closesocket
  38. #define read(soc, data, len) recv(soc, data, len, 0)
  39. #define write(soc, data, len) send(soc, data, len, 0)
  40. #define SHUT_RDWR SD_BOTH
  41. #endif
  42.  
  43. #if defined(__CYGWIN__) || defined(_WIN32)
  44. typedef unsigned char uint8_t;
  45. #ifndef __uint32_t_defined
  46. #define __uint32_t_defined
  47. typedef unsigned int uint32_t;
  48. #endif
  49. typedef unsigned long long int uint64_t;
  50. #else
  51. #if defined(SOLARIS) || defined(sun)|| defined (__FreeBSD__) || defined(HAVE_INTTYPES_H)
  52. #include <inttypes.h>
  53. #else
  54. #include <stdint.h>
  55. #endif
  56. #endif
  57.  
  58. #define MMS_SERVER  0
  59. #define MMS_CLIENT  1
  60.  
  61. #define MMS_NO_LIVE 0
  62. #define MMS_LIVE    1
  63.  
  64. #define MMS_WMV     0
  65. #define MMS_ASF     1
  66.  
  67. #define MMS_TRICK_DISABLED 0
  68. #define MMS_TRICK_ENABLED  1
  69.  
  70. #define MMS_CMD_INVALID            -1
  71. #define MMS_CMD_HELLO             0x01
  72. #define MMS_CMD_PROTOCOL_SELECT   0x02
  73. #define MMS_CMD_FILE_REQUEST      0x05
  74. #define MMS_CMD_READY_TO_STREAM   0x05
  75. #define MMS_CMD_STREAM_INFOS      0x06
  76. #define MMS_CMD_START_PACKET      0x07
  77. #define MMS_CMD_STOP_STREAM       0x09
  78. #define MMS_CMD_BYE_BYE           0x0D
  79. #define MMS_CMD_HEADER_DATA       0x11
  80. #define MMS_CMD_HEADER_REQUEST    0x15
  81. #define MMS_CMD_NET_TESTING       0x15
  82. #define MMS_CMD_PING              0x1B
  83. #define MMS_CMD_PONG              0x1B
  84. #define MMS_CMD_END_OF_STREAM     0x1E
  85. #define MMS_CMD_STREAM_SELECT_ACK 0x21
  86. #define MMS_CMD_STREAM_SELECT     0x33
  87.  
  88. #define MMS_RET_SUCCESS           0
  89. #define MMS_RET_ERROR            -1
  90. #define MMS_RET_NO_AUTH          -2
  91. #define MMS_RET_ACKED            -3
  92.  
  93.  
  94. #define MMS_BUF_SIZE 102400
  95.  
  96. typedef struct
  97. {
  98.   uint8_t buf[MMS_BUF_SIZE];
  99.   int     num_bytes;
  100. } MMS_PACKET ;
  101.  
  102.  
  103. typedef struct
  104. {
  105.   char *host;
  106.   char *path;
  107.   int socket;
  108.   FILE *out;
  109.   FILE *stddebug;
  110.   ssize_t media_packet_len;
  111.   uint64_t expected_file_size;
  112.   int is_live;
  113.   int stream_type;
  114.   int seq_num;
  115.   int num_stream_ids;
  116.   int stream_ids[20];
  117.   int quiet;
  118.   int trick;
  119. } MMS ;
  120.  
  121.  
  122. MMS *   mms_create ( const char *, FILE *, FILE *, const int, const int );
  123. int     mms_connect ( MMS* );
  124. int     mms_handshake ( MMS * );
  125. ssize_t mms_write_stream_header ( MMS * );
  126. int     mms_begin_rip ( MMS * );
  127. ssize_t mms_write_stream_data ( MMS * );
  128. void    mms_disconnect ( MMS * );
  129. void    mms_destroy ( MMS * );
  130.  
  131. #endif
  132.